package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import server.business.pojo.RhType;
import server.business.service.RhTypeService;
import server.business.mapper.RhTypeMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author Galaxy
* @description 针对表【rh_type(RH血型)】的数据库操作Service实现
* @createDate 2022-11-08 12:46:24
*/
@Service("rhTypeService")
public class RhTypeServiceImpl extends ServiceImpl<RhTypeMapper, RhType>
    implements RhTypeService{
    @Autowired
    RhTypeService rhTypeService;

    public List<RhType> queryData(){
        List<RhType> list = rhTypeService.list();
        return list;
    }


    /**
     * fzx
     * @param BloodRh
     * @return
     */
    public String getRh(String BloodRh) {
        QueryWrapper<RhType> rhType= new QueryWrapper<>();
        rhType
                .lambda()
                .eq(RhType::getCode,BloodRh)
                .select(RhType::getName);
        List<Map<String, Object>> list = this.listMaps(rhType);
        return ((String) list.get(0).get("name"));

    }
}




